<?php
namespace Pw\MainBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class GuideType extends AbstractType
{
	
	public function buildForm(FormBuilderInterface $builder, array $options) {
		$builder->add('title', 'text');
		$builder->add('chapters', 'collection', array(
			'type' => new ChapterType(),
			'allow_add' => true,
			'allow_delete' => true,
			'by_reference' => false
		));
	}
    public function getName() {
        return 'guide';
    }
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Pw\MainBundle\Entity\Guide',
            'intention'       => 'guide_item',
        ));
    }
}
